<!doctype html>
<html>
<head>
<title>绑定银行卡 - 经纪人中心 - 全民经纪人</title>
<meta charset="utf-8">
<link rel="stylesheet" href="./source/modules/broke/style/css/style.css"/>
<link rel="apple-touch-icon-precomposed" href="/img/ico-startup-57x57.png" />
<meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0,user-scalable=no" />

<meta name="mobileOptimized" content="width" />
<meta name="handheldFriendly" content="true" />
<meta http-equiv="Cache-Control" content="max-age=0" />
<meta name="apple-touch-fullscreen" content="yes" />
<meta name="apple-mobile-web-app-capable" content="yes" />
<meta name="apple-mobile-web-app-status-bar-style" content="black" />
</head>
<body>
		<section class="main animated fadeInDown">
			<div class="main-box">
               
				<p class="rb-row"><input type="text" class="input" id="bankAccount" value="{$profile['realname']}" readonly style="background:#ccc" /></p>
                <p class="rb-row"><input type="tel" placeholder="请输入您的银行卡号" class="input" id="bankcard" value="{$profile['bankcard']}"/></p>
				<p class="rb-row"><input type="text" placeholder="请输入您的银行名称" class="input" id="banktype" value="{$profile['banktype']}"/></p>
				<div class="recommend-tips">
					<h6>提示</h6>
					<p>为了您能快速结佣请提供详细的开户行信息,如招商银行福州华林支行。</p>
				</div>
				<p class="rb-submit"><input type="button" value="保存" class="btn" id="J_saveCard"/></p>
			</div>
		</section>
<footer class="foot"><a>&copy; {$_W['account']['name']}</a></footer>

<script src="http://libs.baidu.com/jquery/1.7.1/jquery.min.js"></script>
<script src="./source/modules/broke/style/js/com.js"></script>
<script>
//保存银行卡信息
$('#J_saveCard').live("click", function () {
			
	bankcard = $("#bankcard").val();
	banktype = $("#banktype").val();

	if (bankcard == "") {
		TopBox.alert("请选择身份类型!");
		return;
	}
	if (banktype == "") {
		TopBox.alert("姓名不能为空!");
		return;
	}else {
		
		$.ajax({
			type: "POST",
			url: "{php echo $this->createMobileurl('bindbank',array('op'=>'edit'))}",
			data: { 'bankcard': bankcard, 'banktype': banktype},
			dataType: "text",
			
			success: function (d) {
				if (d == "1") {
					
					$("#J_saveCard").hide();
					TopBox.alert("填写成功.", function () { window.location.href = "{php echo $this->createMobileurl('commission',array('id'=>$profile['id']))}"; });
					
				} else if (d == "0") {
					
					TopBox.alert("填写失败.");
				} else {
					
					TopBox.alert("信息填写不正确.");
				}
			},
			
			error: function (xml, text, thrown) {
				TopBox.alert("出错啦!");
			}
		});

	}
});
	
</script>
<script src="./source/modules/broke/style/js/wx.js"></script>
<script type="text/javascript">

WeixinApi.ready(function(Api) {
        Api.showOptionMenu();
        var wxData = {
            "appId": "{$_W['account']['key']}",
            "imgUrl" : '{$_W['siteroot']}/source/modules/broke/icon.jpg',
            "link" : '{php echo $_W['siteroot'].$this->createMobileUrl('index',array('id'=>$id))}',
            "desc" : '看你能捞多少佣金',
            "title" : '全民经纪人-{$_W['account']['name']}'
        };
        // 分享的回调
        var wxCallbacks = {
            // 分享被用户自动取消
            cancel : function(resp) {
                TopBox.alert("分享后获得积分,还有可能得到佣金哦!不要错过发大财的机会!");
            },
            // 分享失败了
            fail : function(resp) {
                TopBox.alert("分享失败，可能是网络问题，一会儿再试试？");
            },
            // 分享成功
            confirm : function(resp) {
             TopBox.alert("分享后成功,等着收佣金吧!");
            },
        };
        Api.shareToFriend(wxData,wxCallbacks);
        Api.shareToTimeline(wxData,wxCallbacks);
        Api.shareToWeibo(wxData,wxCallbacks);
    });

</script>
</body>
</html>